package com.sxx.beautifulcity.entity.greendao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.identityscope.IdentityScopeType;

import com.sxx.beautifulcity.entity.greendao.AgritourismDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.AroundDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.LineDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.HolidayDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.PluckDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.VillageDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.SpeciallyDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.DeliciousFoodDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.PetDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.WeatherDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.BarbecuteDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.KeepHealthDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.UserDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.LoginUserDaoEntityDao;
import com.sxx.beautifulcity.entity.greendao.DetailDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 1): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 1;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
        AgritourismDaoEntityDao.createTable(db, ifNotExists);
        AroundDaoEntityDao.createTable(db, ifNotExists);
        LineDaoEntityDao.createTable(db, ifNotExists);
        HolidayDaoEntityDao.createTable(db, ifNotExists);
        PluckDaoEntityDao.createTable(db, ifNotExists);
        VillageDaoEntityDao.createTable(db, ifNotExists);
        SpeciallyDaoEntityDao.createTable(db, ifNotExists);
        DeliciousFoodDaoEntityDao.createTable(db, ifNotExists);
        PetDaoEntityDao.createTable(db, ifNotExists);
        WeatherDaoEntityDao.createTable(db, ifNotExists);
        BarbecuteDaoEntityDao.createTable(db, ifNotExists);
        KeepHealthDaoEntityDao.createTable(db, ifNotExists);
        UserDaoEntityDao.createTable(db, ifNotExists);
        LoginUserDaoEntityDao.createTable(db, ifNotExists);
        DetailDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
        AgritourismDaoEntityDao.dropTable(db, ifExists);
        AroundDaoEntityDao.dropTable(db, ifExists);
        LineDaoEntityDao.dropTable(db, ifExists);
        HolidayDaoEntityDao.dropTable(db, ifExists);
        PluckDaoEntityDao.dropTable(db, ifExists);
        VillageDaoEntityDao.dropTable(db, ifExists);
        SpeciallyDaoEntityDao.dropTable(db, ifExists);
        DeliciousFoodDaoEntityDao.dropTable(db, ifExists);
        PetDaoEntityDao.dropTable(db, ifExists);
        WeatherDaoEntityDao.dropTable(db, ifExists);
        BarbecuteDaoEntityDao.dropTable(db, ifExists);
        KeepHealthDaoEntityDao.dropTable(db, ifExists);
        UserDaoEntityDao.dropTable(db, ifExists);
        LoginUserDaoEntityDao.dropTable(db, ifExists);
        DetailDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends SQLiteOpenHelper {

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(AgritourismDaoEntityDao.class);
        registerDaoClass(AroundDaoEntityDao.class);
        registerDaoClass(LineDaoEntityDao.class);
        registerDaoClass(HolidayDaoEntityDao.class);
        registerDaoClass(PluckDaoEntityDao.class);
        registerDaoClass(VillageDaoEntityDao.class);
        registerDaoClass(SpeciallyDaoEntityDao.class);
        registerDaoClass(DeliciousFoodDaoEntityDao.class);
        registerDaoClass(PetDaoEntityDao.class);
        registerDaoClass(WeatherDaoEntityDao.class);
        registerDaoClass(BarbecuteDaoEntityDao.class);
        registerDaoClass(KeepHealthDaoEntityDao.class);
        registerDaoClass(UserDaoEntityDao.class);
        registerDaoClass(LoginUserDaoEntityDao.class);
        registerDaoClass(DetailDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}
